<?php
/**
 * Created by PhpStorm.
 * User: yappy
 * Date: 17-6-5
 * Time: 下午3:22
 */

namespace common\components\helpers;
use Yii;

class UserHelper
{
    public $_cache;
    public $_session;
    public $detect;

    public function __construct()
    {
        $this->_cache = Yii::$app->cache;
        $this->_session = Yii::$app->session;
        $this->detect = Yii::$app->isMobile->isMobile();

    }
    public function getLoginFlagArray($userId)
    {
        return ['loginFlag_M'=>$this->_cache->get('loginFlag_M'.$userId),'loginFlag_PC'=>$this->_cache->get('loginFlag_PC'.$userId),'loginFlag_APP'=>$this->_cache->get('app_login_'.$userId)];
    }
    public function removeLogin($userId)
    {
        $this->_cache->delete('loginFlag_PC'.$userId);
        $this->_cache->delete('loginFlag_M'.$userId);
        $this->_cache->delete('app_login_'.$userId);
    }
}